package com.zdkj.subway.stm.util;

import com.zdkj.subway.stm.entity.SwStInputPassengerWorkOther;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class test1 {
    public static void main(String[] args) throws ParseException {
//        List<SwStInputPassengerWorkOther> list = new ArrayList<>();
//
//        SwStInputPassengerWorkOther swStInputPassengerWorkOther = new SwStInputPassengerWorkOther();
//        SwStInputPassengerWorkOther swStInputPassengerWorkOther1 = new SwStInputPassengerWorkOther();
//        swStInputPassengerWorkOther.setFailureOperator("2222");
//        swStInputPassengerWorkOther.setDataType("1");
//        swStInputPassengerWorkOther.setHappenCause("333");
//        swStInputPassengerWorkOther.setTicketNumber(5);
//        swStInputPassengerWorkOther.setAmount(new BigDecimal("2.2"));
//
//        swStInputPassengerWorkOther1.setFailureOperator("2222");
//        swStInputPassengerWorkOther1.setDataType("1");
//        swStInputPassengerWorkOther1.setHappenCause("333");
//        swStInputPassengerWorkOther1.setTicketNumber(2);
//        swStInputPassengerWorkOther1.setAmount(new BigDecimal("3.2"));
//        list.add(swStInputPassengerWorkOther);
//        list.add(swStInputPassengerWorkOther1);
//
//
//        Map<String,List<SwStInputPassengerWorkOther>> countMap = list.stream().collect(Collectors
//                .groupingBy(o -> o.getFailureOperator() + "_" + o.getDataType() + "_" + o.getHappenCause(), Collectors.toList()));
//
//
//        Set<String> keySet = countMap.keySet();
//        for (String key : keySet) {
//            List<SwStInputPassengerWorkOther> swStInputPassengerWorkOthers = countMap.get(key);
//            int sum = swStInputPassengerWorkOthers.stream().mapToInt(SwStInputPassengerWorkOther::getTicketNumber).sum();
//            BigDecimal amount = swStInputPassengerWorkOthers.stream()
//                    // 将对象的mongey取出来map为Bigdecimal
//                    .map(b -> b.getAmount())
//                    // 使用reduce聚合函数,实现累加器
//                    .reduce(BigDecimal.ZERO, BigDecimal::add);
//            SwStInputPassengerWorkOther swStInputPassengerWorkOther2 = swStInputPassengerWorkOthers.get(0);
//            swStInputPassengerWorkOther2.setTicketNumber(sum);
//            swStInputPassengerWorkOther2.setAmount(amount);
//
//        }

//        String [] arr = {"Q001001","Q11212","Q12312"};
//        Arrays.sort(arr);
//        System.out.println(StringUtils.join(arr,","));
//        int c="Q11212".compareTo("Q12312");
//        System.out.println(c);

        String a = "2021-04-26 ";

        SimpleDateFormat dff = new SimpleDateFormat("yyyy-MM-dd");
        Date parse = dff.parse(a);
        String format = dff.format(new Date());
        System.out.println(format);
        int i = parse.compareTo(new Date());
        System.out.println(i);



    }
}
